import { getStore } from '@/util/store'
import { dateFormat } from '@/util/date'
export const option = function () {
  return {
    labelWidth: 120,
    submitText: '保存',
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '申请编号',
        span: 8,
        prop: 'applyCode',
        maxlength: 100,
        disabled: true
      },
      {
        label: '申请人',
        span: 8,
        prop: 'applicant',
        maxlength: 100,
        disabled: true,
        value: getStore({ name: 'userInfo' }).user_name
      },
      {
        label: '申请时间',
        span: 8,
        prop: 'applyDate',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        maxlength: 100,
        disabled: true,
        value: dateFormat(new Date())
      },
      {
        label: '供应商名称',
        span: 8,
        prop: 'supplierName',
        formslot: true,
        rules: [
          {
            required: true,
            message: '请选择供应商',
            trigger: 'change'
          }
        ]
      },
      {
        label: '采购工程师',
        span: 8,
        prop: 'purchaseEngineer',
        maxlength: 100,
        disabled: true
      },
      {
        label: '拟供物料名称',
        span: 8,
        prop: 'materialName',
        maxlength: 50,
        rules: [
          {
            required: true,
            message: '请输入拟供物料名称',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '推荐原因',
        span: 8,
        prop: 'recommendReason',
        type: 'select',
        dicUrl: '/api/blade-system/dict-biz/dictionary?code=supplier_recommend_reasson',
        props: {
          label: 'dictValue',
          value: 'dictKey'
        },
        maxlength: 100,
        rules: [
          {
            required: true,
            message: '请输入推荐原因',
            trigger: 'change'
          }
        ]
      },
      {
        label: '原因说明',
        prop: 'recommendExplain',
        type: 'textarea',
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '附件',
        prop: 'attachments',
        formslot: true,
        span: 24
      }
    ]
  }
}
